#ifndef _SREIALPORT_H_
#define _SREIALPORT_H_

#include<stdio.h>      /*标准输入输出定义*/
#include<stdlib.h>     /*标准函数库定义*/
#include<unistd.h>     /*Unix 标准函数定义*/
#include<sys/types.h>  
#include<sys/stat.h>   
#include<fcntl.h>      /*文件控制定义*/
#include<termios.h>    /*PPSIX 终端控制定义*/
#include<errno.h>      /*错误号定义*/
#include<sys/time.h>
#include<pthread.h>
#include<string.h>
#include "db.h"
pthread_mutex_t mutext,mutext1;
extern int sendQt;
enum M0_ERR_TYPE
{
	M0_ERR = -1,
	M0_OK
};

//int tmp=0,hum=0,light=0;
//int tmp_min=0,tmp_max=20,hum_min=0,hum_max=15,light_min=0,linght_max=0;
//short x=0,y=0,z=0;
int MOfd;
int InitM0(int ID);
int set_serial(int MOfd,int nSpeed,int nBits,char nEvent,int nStop);
int UART0_Recv(int MOfd, unsigned char *rcv_buf,int data_len);
void dataAnal(int MOfd,unsigned char  *rcv_buf, int newID);
void cmd_anal(int MOfd,int cmd_num,unsigned char id);
int UART0_Send(int MOfd, unsigned char *send_buf,int data_len);
#endif
